package com.lq.service.impl;

import com.lq.mapper.ArticleMapper;
import com.lq.pojo.Article;
import com.lq.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArticleServiceImpl implements ArticleService {

    @Autowired
    private ArticleMapper articleMapper;

    @Override
    public int getNumOfPublishArticle(Integer userId) {
        return articleMapper.getNumOfPublishArticle(userId);
    }

    @Override
    public boolean publishArticle(Article article, Integer userId) {
        return articleMapper.publishArticle(article, userId);
    }

    @Override
    public List<Article> getAllArticle() {
        return articleMapper.getAllArticle();
    }

    @Override
    public boolean deleteArticleById(Integer articleId) {
        return articleMapper.deleteArticleById(articleId);
    }

    @Override
    public Article getArticleById(Integer articleId) {
        return articleMapper.getArticleById(articleId);
    }

    @Override
    public List<Article> getLatestArticle(Integer limit) {
        return articleMapper.getLatestArticle(limit);
    }

    @Override
    public String getArticleCategoryByArticleId(Integer articleId) {
        return articleMapper.getArticleCategoryByArticleId(articleId);
    }

    @Override
    public boolean deleteAllArticleComment(Integer articleId) {
        return articleMapper.deleteAllArticleComment(articleId);
    }

    @Override
    public void updateArticleByArticleId(Article article, Integer articleId) {

        articleMapper.updateArticleByArticleId(article, articleId);
    }
}
